<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>我是b页面</h1>
    <div class="box">我是div</div>
    <script>
        // 接收 a页面传入的参数 
        let searchstr = window.location.search;
        console.log(searchstr);
        let type = searchstr.substr(1);
        // console.log(type);
        type = type.split("=")[1];
        console.log(type);

        if(type==1){
            document.querySelector(".box").style.background = "red"
        }else{
            document.querySelector(".box").style.background = "blue"
        }


    </script>
</body>
</html>